<div class="nav"> <a href="{:U('Goods/index')}">商品列表</a> <a class="sel"  href="{:U('Goods/add')}">添加商品</a> </div>
<div class="add" style="margin-top:10px;">
  <form method="post" action="" onsubmit="return checkform()" >
    <div>
      <ul class="panel_handle">
        <li id="handle1" class="sel" style="border-left:1px solid #ccc;" onclick="show_panel(1)">基本信息</li>
        <li id="handle2" onclick="show_panel(2)">商品参数</li>
        <li id="handle3" onclick="show_panel(3)">详细描述</li>
        <li id="handle4" onclick="show_panel(4)" style="display:none">售后保障</li>
        <li id="handle5" onclick="show_panel(5)" style="display:none">搭配商品</li>
      </ul>
      <div class="c"></div>
    </div>
    <div id="panel1" class="panel">
      <table class="table_add" style="margin-top:0px;">
        <tr>
          <td width="100px">所属类别</td>
          <td id="td_cat"><select name="cat_id1" id="cat_id1" dir="1" class="sel1" onchange="get_children('cat_id',1);">
              <option value="">选择一级类别</option>
              <foreach name="parent_cat" item="item">
                <option value="{$item.cat_id}">{$item.cat_name}</option>
              </foreach>
            </select>
            <span id="cate2"></span> <span id="cate3"></span> <span id="cate4" ></span></td>
        </tr>
        <tr>
          <td width="100px">商品名称</td>
          <td><input class="input1" type="text" name="goods_name" id="goods_name" value="" style="width:600px" />
            <label class="msg">*</label>
            &nbsp;&nbsp;
            <select name="brand_id" id="brand_id" class="sel1">
              <option value="">选择品牌</option>
              <foreach name="brand_sel" item="item">
                <option value="{$item.brand_id}" >{$item.brand_name}</option>
              </foreach>
            </select></td>
        </tr>
        <tr>
          <td width="100px">促销信息</td>
          <td><input class="input1" type="text" name="cuxiao_msg" id="cuxiao_msg" value="" style="width:600px" /></td>
        </tr>
        <tr>
          <td width="100px">起购数量</td>
          <td><input class="input1" type="text" name="qi_sale" id="qi_sale" value="1" style="width:100px" /></td>
        </tr>
        <tr>
          <td width="100px">代理分红</td>
          <td><input class="input1" type="number" name="ex_share" id="ex_share" value="0" style="width:100px" /></td>
        </tr>
        
        <tr>
          <td></td>
          <td>单位显示：
            <input class="input1" type="text" name="unit" id="unit" value="" style="width:50px" />
            &nbsp;&nbsp;
            
            购买赠送积分：
            <input class="input1" type="text" name="point" id="point" value="0" style="width:50px" />
            &nbsp;&nbsp;
            
            顺序编号：
            <input class="input1" type="text" name="order_id" id="order_id" value="1000" style="width:60px" />
            <label class="msg">*</label>
            &nbsp;&nbsp;
            
            显示状态：
            <select name="status" id="status" class="sel1">
              <option value="1">上架</option>
              <option value="2">下架</option>
            </select>
            &nbsp;&nbsp;
            
            是否热门：
            <select name="is_hot" id="is_hot" class="sel1">
              <option value="0">不热门</option>
              <option value="1">热门</option>
            </select>
            &nbsp;&nbsp;
            
            首页推荐：
            <select name="is_index" id="is_index" class="sel1">
              <option value="0">不推荐</option>
              <option value="1">推荐</option>
            </select></td>
        </tr>
        <tr>
          <td>商品规格</td>
          <td><table class="table_sub_spec">
              <thead>
                <tr>
                  <th class="th_spec" style="display:none">规格参数</th>
                  <th>商品编号</th>
                  <th>市场价</th>
                  <th>销售价</th>
                  <th style="display:none">成本价</th>
                  <th>重量(g)</th>
                  <th>库存</th>
                  <th>查询</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td><input type="hidden" name="spec_0" id="spec_0" value="" />
                    <input type="hidden" name="spec_id[]" value="0" />
                    <input class="input1" type="text" name="goods_sn_0" id="goods_sn_0" value="" style="width:120px" /></td>
                  <td><input class="input1" type="text" name="price_market_0" id="price_market_0" value="" style="width:60px" /></td>
                  <td><input class="input1" type="text" name="price_0" id="price_0" value="" style="width:60px" /></td>
                  <td style="display:none"><input class="input1" type="text" name="price_cost_0" id="price_cost_0" value="" style="width:60px" /></td>
                  <td><input class="input1" type="text" name="weight_0" id="weight_0" value="" style="width:60px" /></td>
                  <td><input class="input1" type="text" name="num_0" id="num_0" value="100" style="width:60px" /></td>
                  <td><input type="button"  onclick="check_store(0)" value="查询"></td>
                  <td></td>
                </tr>
              </tbody>
            </table>
            <div style="padding:6px 0px;">
              <input type="button" value="选择多规格" class="btn1" onclick="set_spec()" />
            </div>
            <input type="hidden" name="sel_spec_value" id="sel_spec_value" value="" />
            <input type="hidden" name="sel_spec_count" id="sel_spec_count" value="1" /></td>
        </tr>
        <tr>
          <td>商品图片</td>
          <td><include file="Public/uploadfile" filetype="image" id="picture"  value="" editvalue="{}" width="100" path="goods" limit="1" thumbw="220" thumbh="220" msg="220px*220px"/></td>
        </tr>
        <tr>
          <td>上传大图(840px*840px)</td>
          <td><include file="Public/uploadfile" filetype="image" id="picture_list"  value="" editvalue="{}" width="100" path="goods" limit="50" thumbw="840" thumbh="840" msg="840px*840px"/></td>
        </tr>
        <tr>
          <td width="100px">页面标题</td>
          <td><input class="input1" type="text" name="seo_title" id="seo_title" value="" style="width:500px" /></td>
        </tr>
        <tr>
          <td width="100px">页面关键词</td>
          <td><input class="input1" type="text" name="seo_keywords" id="seo_keywords" value="" style="width:500px" /></td>
        </tr>
        <tr>
          <td width="100px">页面描述</td>
          <td><textarea class="textarea1" name="seo_description" id="seo_description" style="width:500px;height:80px;"   ></textarea></td>
        </tr>
        <tr>
          <td width="100px">发布时间</td>
          <td><input onclick="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'})" class="datetime" type="text" name="time_create" id="time_create" value="{$Think.now|strtotime|date='Y-m-d H:i:s',###}" /></td>
        </tr>
      </table>
    </div>
    <div id="panel2" class="panel" style="display:none">
      <table class="table_add" style="margin-top:0px;">
        <tr>
          <td>PC</td>
        </tr>
        <tr>
          <td><include file="Public/kindeditor" id="detail2" value="" thumbw="12000" thumbh="12000"/></td>
        </tr>
        <tr>
          <td>手机</td>
        </tr>
        <tr>
          <td><include file="Public/kindeditor" id="detail3" value="" thumbw="1200" thumbh="1200"/></td>
        </tr>
      </table>
    </div>
    <div id="panel3" class="panel" style="display:none">
      <table class="table_add" style="margin-top:0px;">
        <tr>
          <td><include file="Public/kindeditor" id="detail" value="" thumbw="12000" thumbh="12000"/></td>
        </tr>
      </table>
    </div>
    <div id="panel4" class="panel" style="display:none">
      <table class="table_add" style="margin-top:0px;">
        <tr>
          <td></td>
        </tr>
      </table>
    </div>
    <div id="panel5" class="panel" style="display:none">
      <table class="table_add" style="margin-top:0px;">
        <tr>
          <td style="padding:10px;text-align:center;"><input type="button" onclick="select_goods()" value="点击选择需要推荐搭配的商品" class="btn4" /></td>
        </tr>
        <tr>
          <td id="tuijian_goods_list"></td>
        </tr>
      </table>
      <input type="hidden" name="tuijian" id="tuijian" value="" />
    </div>
    <div style="text-align:center;padding:10px;">
      <input type="submit" class="btn1" value="提 交" />
      &nbsp;
      <input class="btn3"  type="button" onclick="window.history.back()" value="返 回" />
    </div>
  </form>
</div>
<script type="text/javascript">

function get_children(n,m) {

	    var child_level = m+1;

	     var parent_id = $('#'+n+m).val();

            $("#cate"+child_level).load("{:U('GoodCate/get_children')}?parent_id=" + parent_id+"&level_id="+child_level);

            for(i=child_level+1;i<5;i++){

			$("#cate"+i).html("");

			}

			

        }



</script> 
<script src="__PUBLIC__/common/artDialog4.1.7/artDialog.source.js?skin=blue" type="text/javascript"></script> 
<script src="__PUBLIC__/common/artDialog4.1.7/plugins/iframeTools.source.js" type="text/javascript"></script> 
<script type="text/javascript">

    var url_set_spec = "{:U('Goods/set_spec')}";

    var url_get_model_par = "{:U('Goods/get_model_par')}";

    var url_select_tuijian = "{:U('Goods/select_tuijian')}";

    var url_show_tuijian = "{:U('Goods/show_tuijian')}";

</script> 
<script src="__PUBLIC__/admin/js/goods.js?20181218" type="text/javascript"></script> 
<script type="text/javascript">

    //首次自动增加一个类别

    add_cat();

</script> 